package com.ql.service.role.impl;

import com.ql.dao.user.RoleMapper;
import com.ql.pojo.user.Role;
import com.ql.service.role.RoleService;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;


@Service("roleService")
public class RoleServiceImpl implements RoleService {

    private static final Logger LOGGER = Logger.getLogger(RoleServiceImpl.class);
    @Resource
    private RoleMapper roleMapper;
    @Override
    public List<Role> getAllRole() {
        List<Role> roleList = new ArrayList<>();

        try {
            roleList = roleMapper.getAllRole();
            if (roleList.size()<=0){
                LOGGER.debug("RoleServiceImpl.getAllRole 查询为空！");
            }else {
                LOGGER.debug("RoleServiceImpl.getAllRole 查询成功！");
            }
        } catch (Exception e) {
            LOGGER.debug("RoleServiceImpl.getAllRole 查询异常！》》》"+e.getMessage());
        }
        return roleList;
    }

    @Override
    public List<Role> findRole() {
        List<Role> roles = roleMapper.selectByExample(null);
        return roles;
    }
}
